package com.iphanta.community.following.web.admin;

import com.iphanta.community.common.entity.DataResult;
import com.iphanta.community.common.utils.ResultUtils;
import com.iphanta.community.following.service.AdminCommentsService;
import com.iphanta.community.following.traffic.admin.AdminDeleteCommentRequest;
import com.iphanta.community.following.traffic.admin.AdminDeleteCommentResponse;
import com.iphanta.community.following.traffic.admin.AdminQueryCommentsRequest;
import com.iphanta.community.following.traffic.admin.AdminQueryCommentsResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台管理-评论
 *
 * @author 墨声 E-mail: zehong.hongframe.huang@gmail.com
 * create time: 4/24/22 6:21 PM
 */
@RestController
@RequestMapping("community/admin/comments/")
public class AdminCommentsController {

    @Autowired
    private AdminCommentsService commentsService;

    /**
     * 查询
     *
     * @param request
     * @return
     */
    @PostMapping("query")
    public DataResult<AdminQueryCommentsResponse> query(@RequestBody AdminQueryCommentsRequest request) {
        return ResultUtils.SUCCESS.result(commentsService.query(request));
    }

    /**
     * 删除
     *
     * @param request
     * @return
     */
    @PostMapping("delete")
    public DataResult<AdminDeleteCommentResponse> delete(@RequestBody AdminDeleteCommentRequest request) {
        return ResultUtils.SUCCESS.result(commentsService.delete(request));
    }
}
